import request from '@/utils/request'

// 查询行政区列表
export function listAdministrative(query) {
  return request({
    url: '/system/administrative/list',
    method: 'get',
    params: query
  })
}

// 查询行政区详细
export function getAdministrative(administrativeId) {
  return request({
    url: '/system/administrative/' + administrativeId,
    method: 'get'
  })
}

// 新增行政区
export function addAdministrative(data) {
  return request({
    url: '/system/administrative',
    method: 'post',
    data: data
  })
}

// 修改行政区
export function updateAdministrative(data) {
  return request({
    url: '/system/administrative',
    method: 'put',
    data: data
  })
}

// 删除行政区
export function delAdministrative(administrativeId) {
  return request({
    url: '/system/administrative/' + administrativeId,
    method: 'delete'
  })
}

// 导入行政区
export function importAdministrative(data, config) {
  return request({
    url: '/system/administrative/import',
    method: 'post',
    data: data,
    ...config
  })
}

/**
 * 下载模板
 * @param data
 * @returns {*}
 */
export function exportTemplate(data) {
  return request({
    url: '/system/administrative',
    method: 'put',
    data: data
  })
}
/**
 * 查询树结构
 * @param data
 * @returns {*}
 */
export function listAdministrativeByTree(query) {
  return request({
    url: '/system/administrative/listAdministrativeByTree',
    method: 'get',
    params: query
  })
}
